import { THREE } from "../three.js";

const scene = new THREE.Scene();

// box
const geometry = new THREE.BoxGeometry(1, 1, 1);

// material
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });

// mesh
const mesh = new THREE.Mesh(geometry, material);

scene.add(mesh);

// Sizes
const sizes = {
  width: 800,
  height: 600,
  aspect() {
    return this.width / this.height;
  },
};

// Camera
const camera = new THREE.PerspectiveCamera(75, sizes.aspect(), 0.1, 1000);
camera.position.z = 3;
scene.add(camera);

// Renderer
const canvas = document.querySelector("canvas.webgl");
const renderer = new THREE.WebGLRenderer({
  canvas,
});

renderer.setSize(sizes.width, sizes.height);

renderer.render(scene, camera);
